import request from '@/common/request';
import config from '@/common/config';

// eslint-disable-next-line import/prefer-default-export
export async function getMenu(id) {
  const result = await request({
    url: `${config.server}/menu/restaurantId/${id}`,
    method: 'get',
  });
  return result;
}
export async function placeOrderRequest({
  payment, cart, userId, restaurantId, token,
}) {
  const result = await request({
    url: `${config.server}/order`,
    method: 'put',
    header: {
      Authorization: token,
    },
    data: {
      payment, // 存在localstorage中的payment的value
      cart, // 全部菜品平铺
      userId, // 用户id
      restaurantId, // 餐馆id
    },

  });
  return result;
}
